import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str1=in.next();
        String str2=in.next();
        chStr(str1,str2);
    }
    public static void chStr(String str1,String str2){
        String s1=str1.toUpperCase();
        String s2=str2.toUpperCase();
        char[] ch1=s1.toCharArray();
        char[] ch2=s2.toCharArray();
        Set<Character> set1=new HashSet<>();
        Set<Character> set2=new HashSet<>();
        for(int i=0;i<ch2.length;i++){
            set1.add(ch2[i]);
        }
        for(int i=0;i<ch1.length;i++){
            if(!set1.contains(ch1[i])&&!set2.contains(ch1[i])){
                System.out.print(ch1[i]);
                set2.add(ch1[i]);
            }
        }
    }
}